// widgets/task_transaction_record_cell.dart
import 'package:flutter/material.dart';
import '../../../../repository/model/task_withdraw_record_model.dart';

class TaskTransactionRecordCell extends StatelessWidget {
  final TaskWithdrawRecordModel record;
  final bool showLine;

  const TaskTransactionRecordCell({
    Key? key,
    required this.record,
    this.showLine = true,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 58,
      padding: const EdgeInsets.symmetric(horizontal: 15),
      decoration: BoxDecoration(
        border: showLine
            ? const Border(
          bottom: BorderSide(
            color: Color(0xFFEEEEEE),
            width: 0.5,
          ),
        )
            : null,
      ),
      child: Row(
        children: [
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  record.description,
                  style: const TextStyle(
                    fontSize: 15,
                    color: Color(0xFF262626),
                    fontWeight: FontWeight.w500,
                  ),
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                ),
                const SizedBox(height: 4),
                Text(
                  record.exchangeDay.isNotEmpty
                      ? record.exchangeDay
                      : record.createTime,
                  style: const TextStyle(
                    fontSize: 13,
                    color: Color(0xFF999999),
                  ),
                ),
              ],
            ),
          ),
          Column(
            mainAxisAlignment: record.statusDescription.isNotEmpty
                ? MainAxisAlignment.spaceBetween
                : MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.end,
            children: [
              if (record.statusDescription.isNotEmpty)
                Text(
                  record.statusDescription,
                  style: const TextStyle(
                    fontSize: 12,
                    color: Color(0xFF666666),
                  ),
                ),
              Text(
                record.amount,
                style: const TextStyle(
                  fontSize: 16,
                  color: Color(0xFF262626),
                  fontWeight: FontWeight.w500,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}